#include <ostream>
#include "stdafx.h"
#include "../common/WindbgExt.h"
#include "../common/ScriptExtInterface.h"

WindbgExt *dbgengine = NULL;

EXTERN_C int SetWindbgInterface(WindbgExt* iface)
{
	dbgengine = iface;
	return 0;
}

WindbgExt* STDMETHODCALLTYPE dbg()
{
	return dbgengine;
}

int PrintErr(const char* msg, int ret)
{
	if (dbgengine)
	{
		dbgengine->Err(msg);
		char buf[64];
		sprintf(buf, "Error code: 0x%08lX\n", ret);
		dbgengine->Err(buf);
	}
	return ret;
}

int PrintErr(const wchar_t* msg, int ret)
{
	if (dbgengine)
		dbgengine->ErrW(msg);
	return ret;
}

EXTERN_C int RunScript(const char** params)
{
	return 1;
}


BOOL APIENTRY DllMain(HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		break;
	case DLL_THREAD_ATTACH:
		break;
	case DLL_THREAD_DETACH:
		break;
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}


